module AuthorsHelper
  def hcard(author)
    open :div, {:class => 'vcard', :id => author.hcard_id } do
      open :span, {:class => 'fn n'} do
        open :span, {:class => 'given-name'} do
          puts h(author.first_name)
        end
        open :span, {:class => 'additional-name'} do
          puts h(author.middle_initial)
        end unless author.middle_initial.blank?
        open :span, {:class => 'family-name'} do 
          puts h(author.last_name)
        end
      end
      open :a, {:class => 'email', :href=>"mailto:#{h author.email}"} do
        puts h(author.email)
      end
    end
  end
end